/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.geftu.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author jorgenei
 */
@Entity
@Table(name = "tb_participa", catalog = "bddefeitos", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Participa.findAll", query = "SELECT t FROM Participa t"),
    @NamedQuery(name = "Participa.findByIdpart", query = "SELECT t FROM Participa t WHERE t.idpart = :idpart"),
    @NamedQuery(name = "Participa.findByDtinicial", query = "SELECT t FROM Participa t WHERE t.dtinicial = :dtinicial"),
    @NamedQuery(name = "Participa.findByDtfinal", query = "SELECT t FROM Participa t WHERE t.dtfinal = :dtfinal")})
public class Participa implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @SequenceGenerator(name="idpart", sequenceName="participa_seq", allocationSize=1)
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="idpart")    
    @Basic(optional = false)
    @Column(name = "idpart", nullable = false)
    private Integer idpart;
    @Basic(optional = false)
    @Column(name = "dtinicial", nullable = false, length = 20)
    private String dtinicial;
    @Column(name = "dtfinal", length = 20)
    private String dtfinal;
    @JoinColumn(name = "projeto", referencedColumnName = "idproj", nullable = false)
    @ManyToOne(optional = false)
    private Projeto projeto;
    @JoinColumn(name = "funcao", referencedColumnName = "idfunc", nullable = false)
    @ManyToOne(optional = false)
    private Funcao funcao;
    @JoinColumn(name = "desenvolvedor", referencedColumnName = "iddes", nullable = false)
    @ManyToOne(optional = false)
    private Desenvolvedor desenvolvedor;

    public Participa() {
    }

    public Participa(Integer idpart) {
        this.idpart = idpart;
    }

    public Participa(Integer idpart, String dtinicial) {
        this.idpart = idpart;
        this.dtinicial = dtinicial;
    }

    public Integer getIdpart() {
        return idpart;
    }

    public void setIdpart(Integer idpart) {
        this.idpart = idpart;
    }

    public String getDtinicial() {
        return dtinicial;
    }

    public void setDtinicial(String dtinicial) {
        this.dtinicial = dtinicial;
    }

    public String getDtfinal() {
        return dtfinal;
    }

    public void setDtfinal(String dtfinal) {
        this.dtfinal = dtfinal;
    }

    public Projeto getProjeto() {
        return projeto;
    }

    public void setProjeto(Projeto projeto) {
        this.projeto = projeto;
    }

    public Funcao getFuncao() {
        return funcao;
    }

    public void setFuncao(Funcao funcao) {
        this.funcao = funcao;
    }

    public Desenvolvedor getDesenvolvedor() {
        return desenvolvedor;
    }

    public void setDesenvolvedor(Desenvolvedor desenvolvedor) {
        this.desenvolvedor = desenvolvedor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idpart != null ? idpart.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Participa)) {
            return false;
        }
        Participa other = (Participa) object;
        if ((this.idpart == null && other.idpart != null) || (this.idpart != null && !this.idpart.equals(other.idpart))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return idpart + "";
    }
    
}
